package com.hspedu.properties;

import java.io.FileWriter;
import java.io.IOException;
import java.util.Properties;

/**
 * @author 谷其昊
 * @version 1.0
 * @date 2022/2/26
 * @time 18:52
 */
public class Properties04 {
    public static void main(String[] args) throws IOException {
        Properties properties = new Properties();
        //创建键值对，此时键值对是保存在内存中的
        properties.setProperty("charset","utf8");
        properties.setProperty("user","root");
        properties.setProperty("pwd","abc111");

        //将键值对存储到文件中
        properties.store(new FileWriter("D:\\workspace_idea\\java0\\hspedu\\chapter19\\src\\mysql2.properties"),null);
        System.out.println("文件保存成功");
    }
}
